<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue"></script> -->
    <script src="js/vue.min.js"></script>
</head>
<div class="box">
    <p>{{msg}}</p>

    <input type="button" value="走起" v-on:click="show">
    <input type="button" value="停止" v-on:click="stap">
</div>

<body>
    <script>
        /**
            *---插值表达式: v-text="" v-html="" c-on:click=""  v-band="" 

        **/
        var ve = new Vue({
            //el: 控制元素
            el: ".box",
            data: { //date控制数据;
                msg: "你好,vue啊啊啊啊啊啊",
                intervalId: null,
            },
            methods: { //这个methods属性中定义了当前vue实例所有可用的方法
                show: function () {
                    console.log(123);
                    // alert("第一次弹窗");
                    if(this.intervalId!=null) return;
                    // clearInterval(this.intervalId);
                    this.intervalId = setInterval(() => {
                        var start = this.msg.substring(0, 1);
                        var end = this.msg.substring(1);
                        this.msg = end + start;
                        console.log(this.msg)
                    }, 40)

                },
                stap: function(){
                    clearInterval(this.intervalId);
                    this.intervalId = null;
                }
            },
        })
    </script>



</body>

</html>